<?php
//我的提案

function wode_default(){
    wode_page();
}
function wode_page(){
    _output_template(0,'wode');
}


function _zhengxie_outputWode(){
    $nav_name = '我的提案:';
    if (empty($_REQUEST['proposalID'])){
        $str= " <div style='padding: 25px; border-radius: 10px;height: 93%;background-color: white; -webkit-box-shadow: #e2f0fe 0px 0px 10px;-moz-box-shadow: #e2f0fe 0px 0px 10px;box-shadow: #e2f0fe 0px 0px 10px;'>
                <div style='width: 100%;min-height: 120px;height: 10%'>
                    <div class='mark' id='".$GLOBALS['ACTION']."' style='color: #429de3;height: 50%;font-size: 18px;'>".$nav_name."</div>
                    <div style='height: 50%;'>";


        $str.="         <div class='box' style='float: left;height: 100%;display: inline-block;position: relative;top: 50%;transform: translateY(-50%)'>
                            <span style='font-size: 16px;float: left;height: 40px;line-height: 40px;margin-right: 15px;position: relative;top: 50%;transform: translateY(-50%)'>状态:</span>
                            <span class='select' style='background-image: url(images/wode/sanjiao.png);background-repeat: no-repeat;background-position: 90%;position: relative;top: 50%;transform: translateY(-50%);'>所有提案</span>
                        </div>";

        $str .= "               
                        <ul class='sub'>
                            <li>所有提案</li>
                            <li>审查提案</li>
                            <li>交办提案</li>
                            <li>办理提案</li>
                            <li>已办提案</li>
                        </ul>
                        <style>
                            .sub{list-style-type:none;}
                            .select{font-size: 16px;color: #666;text-indent: 15px;border: 1px solid #e5e5e5;float: left;border-radius: 4px;width:204px;height:40px;cursor:pointer;line-height:40px;}
                            .sub{font-size: 16px;position: absolute;top: 246px;left:314px;color:#e5e5e5;width:204px;background:#fff;border:1px solid #e5e5e5;display: none;}
                            .sub li{color: #666666;height:40px;text-align: center;line-height:40px;cursor:pointer;border-bottom:1px solid #e5e5e5;}
                            .sub li.hover{background:#8b8b8b;}
                        </style>
                        <script type='text/javascript'>
                            $('.select').click(function(event) {
                                $('.sub').css('display') == 'none' ? $('.sub').css('display','block') : $('.sub').css('display','none');
                            });
                            
                            $('.sub li').each(function() {
                                $(this).mouseover(function() {
                                    $(this).css('background-color','#429de3');
                                });
                                
                                $(this).mouseout(function() {
                                    $(this).css('background-color','#fff');
                                });
                                
                                $(this).click(function() {
                                  var text = $(this).text();
                                  $('.select').html(text);
                                  switch (text){
                                      case '所有提案':
                                          getMyDataList('suoyou','',1);
                                          break;
                                      case '审查提案':
                                          getMyDataList('shencha','',1);
                                          break;
                                      case '交办提案':
                                          getMyDataList('jiaoban','',1);
                                          break;
                                      case '办理提案':
                                          getMyDataList('banli','',1);
                                          break;
                                      case '已办提案':
                                          getMyDataList('yiban','',1);
                                          break;
                                  }
                                  $('.sub').css('display','none');
                                });
                            });
                        </script>";


        $str .= "       <div style='display: inline-block;width: 33%;height: 100%;margin-left: 10%;float: left'>
                            <div style='height: 54px;position: relative;top: 50%;transform: translateY(-50%);'>
                                <span style='font-size: 16px;float: left;height: 50px;line-height: 50px;'>提案理由:</span>
                                <div style='padding-left: 80px;position: relative;top: 50%;transform: translateY(-50%)'>
                                    <input class='my_search_keyword' type='text' style='font-size: 16px;color: #666;height: 40px;width: 100%;border: 1px solid #e5e5e5;border-radius: 4px;'>
                                </div>
                            </div>
                            <!--<input type='text' style='font-size: 16px;color: #666;height: 40px;width: 100%;border: 1px solid #e5e5e5;border-radius: 4px;position: relative;top: 50%;transform: translateY(-50%);'>-->
                        </div>
                        <div style='display: inline-block; height: 100%;float: left;margin-left: 15px'>
                            <div style='height: 54px;position: relative;top: 50%;transform: translateY(-50%);'>
                                <button onclick='searchMyproposal(1);' style='font-size: 16px;color: white;border-radius: 5px;background-color: #42d79e;width: 76px;height: 41px;margin-right: 15px;margin-left: 15px;border: none'>查询</button>
                                <button onclick='clearKeyword();' style='font-size: 16px;color: #42d79e;border-radius: 5px;border: 1px solid #42d79e;background-color: #fff;width: 76px;height: 41px;'>重置</button>
                            </div>
                        </div>";
        $str .= "       <div style='width: 12%;display: inline-block;height: 100%;float: right;'>
                            <div style='height: 48px;position: relative;top: 50%;transform: translateY(-50%);'>
                                <script>
                                    function news() {
                                      window.location.href = \"/index.php?action=xinjian\";
                                    }
                                </script>
                            </div>
                        </div>";
        if (empty($_REQUEST['page'])){
            $page = 1;
        }else{
            $page = $_REQUEST['page'];
        }

        $str .= "               
                    </div>
                </div>
                <div style='min-height: 750px;width: 100%;height: 85%;margin-top:3%;'>
                    <div class='datalist' id='".$page."' style='height: 90%;'>
                    </div>
                    
                    <div  style='height: 10%; position: relative'>
                        <div  style='display: inline-block;position: absolute;top: 28%;left: 50%;transform: translateX(-50%)'>
                            <div class='listtab' style='display: inline-block'>
                                
                            </div>
                        </div>
                    </div>
                    <script>getMyDataList('suoyou','',1);</script>
                </div>
            </div>";
        return $str;

    }else{
        //取出参数
        $proposalID =  $_REQUEST['proposalID'];
        $data = getProposalInfo($proposalID);
        //(1:待审查,2:未立案,3:待交办,4:办理中,5:待反馈,6:办完结)
        switch ($data['state']){
            case '1':
                return _zhengxie_outputShencha();
                break;
            case '2':
                return _zhengxie_outputShencha();
                break;
            case '3':
                return _zhengxie_outputJiaoban();
                break;
            case '4':
                return _zhengxie_outputBanli();
                break;
            case '5':
                return _zhengxie_outputDaifankui();
                break;
            case '6':
                return _zhengxie_outputYiban();
                break;
        }
    }
}

function zhengxie_outputWodeDialog(){
    if (!empty($_REQUEST['chakan'])){
        $chakan = $_REQUEST['chakan'];
    }
    if (!empty($chakan)){
        $data = getRecordToId($chakan);
        $str="<script>$('.reuse_dialog').show()</script>";
        switch ($data['operatetype']){
            case '3'://不立案
                return $str.zhengxie_outputShenChaDialog($data);
                break;
            case '7'://退回
                return $str.zhengxie_outputBanliDialog($data);
                break;
            case '10'://不满意
                return $str.zhengxie_outputDaiFanKuiDialog($data);
                break;
        }
    }else{
        //新增操作dialog分发
        if (!empty($_REQUEST['dialog'])){
            $dialog = $_REQUEST['dialog'];
        }

        if (!empty($dialog)){
            switch ($dialog){
                case 'shenchadialog':
                    return zhengxie_outputShenChaDialog(array());
                    break;
                case 'jiaobandialog':
                    return zhengxie_outputJiaobanDialog(array());
                    break;
                case 'banlidialog':
                    return zhengxie_outputBanliDialog(array());
                    break;
            }
        }
    }
}